﻿using KuiHuaBaoDian.Services.Guide;
using UnityEngine.UIElements;

namespace KuiHuaBaoDian.GuideGraph.Editor {

    [CustomElement(typeof(GuideStep_SetVariable))]
    public sealed class GuideStep_SetVariable_Node : GuideGraphEntityNode {

        public GuideStep_SetVariable_Node(GuideEntity entity, GuideGraphView view) : base(entity, view) {
        }

        public new GuideStep_SetVariable Entity => (base.Entity as GuideStep_SetVariable);

        private Label m_KeyLabel;

        protected override void OnInitialized() {
            base.OnInitialized();
            style.minWidth = 120;

            titleLabelContainer.Add(new Label("标记为"));
            m_KeyLabel = new Label();
            titleLabelContainer.Add(m_KeyLabel);
            PropertyChanged += () => {
                m_KeyLabel.text = $"<{Entity.Key}>";
            };
        }
    }
}
